package com.ds.config;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.io.IOException;
import java.util.Properties;

public class DataSourceConfig {
    public static DataSource dataSource;
    static {
        Properties properties = new Properties();
        try {
            properties.load(DataSourceConfig.class.getResourceAsStream("/jdbc.properties"));
            dataSource = DruidDataSourceFactory.createDataSource(properties);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static DataSource getDataSource(){
        return dataSource;
    }
}
